﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TeacherHome.aspx.cs" Inherits="Teacher_CORRECTASKANSWER" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>

    <script src="../layui/layui.js"></script>
    <script src="../JS/jquery-3.3.1.min.js"></script>
    <link href="../layui/css/layui.css" rel="stylesheet" />
    <script src="../JS/echarts.common.min.js"></script>
    <script src="../JS/dark.js"></script>

</head>
<body>
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="MenberCompany" style="width: 1200px; height: 400px;"></div>
    <br />
    <div id="CompanyScore" style="width: 1200px; height: 400px; float: left"></div>
    <script type="text/javascript">
        $.ajax({
            type: "post",
            url: '/handler/EMSsystem.ashx?Action=Echarts&Method=MenberCompany', //数据接口
            success: function (obj) {
                if (obj) {
                    var back = eval('(' + obj + ')');
                    var reu = [];
                    for (var a in back.data) {
                        var t = back.data[a];
                        reu.push(t);
                    }
                    myChart.hideLoading();    //隐藏加载动画
                    myChart.setOption({        //加载数据图表
                        dataset: {
                            dimensions: ['COMPANY', '公司人数', '参加测验数'],
                            source: reu
                        }
                    });
                }
            }
        });
        $.ajax({
            type: "post",
            url: '/handler/EMSsystem.ashx?Action=Echarts&Method=CompanyPercent', //数据接口
            success: function (obj) {
                if (obj) {
                    var back = eval('(' + obj + ')');
                    var company = [];
                    var score = [];
                    for (var a in back.data) {
                        company.push(back.data[a].COMPANY);
                        score.push(back.data[a].percent);
                    }
                    myChart2.hideLoading();    //隐藏加载动画
                    myChart2.setOption({        //加载数据图表
                        xAxis: [
                            {
                                type: 'category',
                                data: company
                            }
                        ],
                        series: [
                            {
                                name: '平均得分',
                                type: 'bar',
                                data: score,
                                markLine: {
                                    data: [
                                        { type: 'average', name: '平均值' }
                                    ]
                                }
                            }
                        ]

                    });

                }
            }
        });
        var myChart = echarts.init(document.getElementById('MenberCompany'), 'dark');
        var myChart2 = echarts.init(document.getElementById('CompanyScore'), 'dark');
        myChart.showLoading();
        var option1 = {
            title: {
                text: '公司人数表'
            },
            legend: {},
            tooltip: {},

            xAxis: { type: 'category' },
            yAxis: {},
            series: [
                { type: 'bar' },
                { type: 'bar' }
            ]
        };
        var option2 = {
            title: {
                text: '平均得分',
                subtext: '依公司考试成绩'
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data: ['平均分']
            },
            toolbox: {
                show: true,
                feature: {
                    dataView: { show: true, readOnly: false },
                    magicType: { show: true, type: ['line', 'bar'] },
                    restore: { show: true },
                    saveAsImage: { show: true }
                }
            },
            calculable: true,
            xAxis: [
                {
                    type: 'category',
                }
            ],
            yAxis: [
                {
                    type: 'value'
                }
            ]

        };

        myChart.setOption(option1);
        myChart2.setOption(option2);
    </script>
</body>
</html>
